import request from '@/utils/request'

// 查询库存调拨列表
export function listTransfer(query) {
  return request({
    url: '/system/transfer/list',
    method: 'get',
    params: query
  })
}

// 查询库存调拨详细
export function getTransfer(id) {
  return request({
    url: '/system/transfer/' + id,
    method: 'get'
  })
}

// 新增库存调拨
export function addTransfer(data) {
  return request({
    url: '/system/transfer',
    method: 'post',
    data: data
  })
}

// 修改库存调拨
export function updateTransfer(data) {
  return request({
    url: '/system/transfer',
    method: 'put',
    data: data
  })
}

// 删除库存调拨
export function delTransfer(id) {
  return request({
    url: '/system/transfer/' + id,
    method: 'delete'
  })
}

// 提交库存调拨
export function submitTransfer(id) {
  return request({
    url: '/system/transfer/submit/' + id,
    method: 'put'
  })
}

// 撤回调拨
export function withdrawTransfer(id) {
  return request({
    url: '/system/transfer/withdraw/' + id,
    method: 'put'
  })
}

// 确认调拨
export function confirmTransfer(id) {
  return request({
    url: '/system/transfer/confirm/' + id,
    method: 'put'
  })
}

// 根据仓库ID获取商品列表
export function listGoodsByWarehouse(warehouseId) {
  return request({
    url: '/system/transfer/goods/' + warehouseId,
    method: 'get'
  })
}
